/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.workflow.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.hera.base.domain.BaseDomain;
import com.hera.process.security.domain.User;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "PROCESS_SUPERVISOR")
public class ProcessSupervisor  extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ProcessSupervisorPK processSupervisorPK;
    @JoinColumn(name = "ID_USER", referencedColumnName = "ID_USER", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private User sysUser;
    @JoinColumn(name = "ID_PROCESS", referencedColumnName = "ID_PROCESS", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Process process;

    public ProcessSupervisor() {
    }

    public ProcessSupervisor(ProcessSupervisorPK processSupervisorPK) {
        this.processSupervisorPK = processSupervisorPK;
    }

    public ProcessSupervisor(Long idProcess, Long idUser) {
        this.processSupervisorPK = new ProcessSupervisorPK(idProcess, idUser);
    }

    public ProcessSupervisorPK getProcessSupervisorPK() {
        return processSupervisorPK;
    }

    public void setProcessSupervisorPK(ProcessSupervisorPK processSupervisorPK) {
        this.processSupervisorPK = processSupervisorPK;
    }
    public User getSysUser() {
        return sysUser;
    }

    public void setSysUser(User sysUser) {
        this.sysUser = sysUser;
    }

    public Process getProcess() {
        return process;
    }

    public void setProcess(Process process) {
        this.process = process;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (processSupervisorPK != null ? processSupervisorPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof ProcessSupervisor)) {
            return false;
        }
        ProcessSupervisor other = (ProcessSupervisor) object;
        if ((this.processSupervisorPK == null && other.processSupervisorPK != null) || (this.processSupervisorPK != null && !this.processSupervisorPK.equals(other.processSupervisorPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.ProcessSupervisor[ processSupervisorPK=" + processSupervisorPK + " ]";
    }
    
}
